package com.mdhw.utils;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Random;
import java.util.UUID;

public class UUIDGeneratorUtil {

	private static SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddHHmmssSSS");

	/**
	 * 产生一个32位的UUID
	 *
	 * @return
	 */
	public static String generate() {
		return UUID.randomUUID().toString().replaceAll("-", "").toLowerCase();
	}


	/**
	 *  生成订单
	 * @param prefix 前缀
	 * @return
	 */
	public static String generateOrderId(String prefix) {
		String format = simpleDateFormat.format(new Date());
		Random random = new Random();
		int ran = random.nextInt(999);
		ran+=100;
		return prefix+simpleDateFormat.format(new Date())+ran;
	}



}
